<template>
 <div class="newInfo-cntainer">
   <h3 class="title">{{newsinfo.title}}</h3>
   <p class="subtitle">
     <span>发布时间:{{newsinfo.add_time}}</span>
     <span>点击{{newsinfo.click}}次</span>
   </p>
   <hr>
   <div class="content">{{newsinfo.content}}</div>

   <Comments></Comments>
 </div>
</template>

<script>

import Comments from '../../components/subcomponents/Comments'

export default {
  name: "",
  data() {
    return {
      id: 0,
      newsinfo:{}
    };
  },
  created() {
    this.id = this.$route.params.id;
    this.getnewInfo()
  },
  methods:{
    getnewInfo(){
      this.$http.get('http://localhost:5000/api/getnew/ ' +this.id).then((result) => {
        console.log(result)
        if(result.body.status === 0) {
          this.newsinfo = result.body.message
        }else{

        }
      })
    }
    
  },
  components:{
    Comments
  }
};
</script>

<style lang="less" scoped>
  .newInfo-cntainer {
    padding: 0px 4px;
    .title {
      font-size:16px;
      text-align: center;
      margin: 15px 0;
      color:orange;
    }
   .subtitle {
   font-size: 13px;
   color:#226aff;
   display: flex;
   justify-content: space-between;
   }
   .content{

   }
  }
</style>
